#include <stdio.h>
#include <math.h>
#include <time.h>

#include "include/tools/complex.h"
#include "include/tools/fft.h"
#include "include/exception.h"
#include "include/tools/angle.h"

int main(){
	float data[] = {
	 0.07, 0.15, 0.22, 0.29, 0.37, 0.44, 0.51, 0.58, 0.65, 0.71, 0.78, 0.85, 0.91, 0.97, 1.03, 1.09,
	 1.15, 1.20, 1.25, 1.30, 1.35, 1.40, 1.44, 1.48, 1.52, 1.55, 1.59, 1.62, 1.64, 1.67, 1.69, 1.71,
	 1.72, 1.74, 1.75, 1.75, 1.76, 1.76, 1.76, 1.76, 1.75, 1.74, 1.73, 1.71, 1.70, 1.68, 1.66, 1.63,
	 1.60, 1.58, 1.55, 1.51, 1.48, 1.44, 1.40, 1.36, 1.32, 1.28, 1.24, 1.19, 1.14, 1.10, 1.05, 1.00,
	 0.95, 0.90, 0.85, 0.80, 0.75, 0.70, 0.65, 0.60, 0.55, 0.50, 0.45, 0.40, 0.35, 0.31, 0.26, 0.22,
	 0.17, 0.13, 0.09, 0.05, 0.01,-0.02,-0.06,-0.09,-0.12,-0.15,-0.18,-0.21,-0.23,-0.25,-0.27,-0.29,
	-0.31,-0.32,-0.34,-0.35,-0.35,-0.36,-0.37,-0.37,-0.37,-0.37,-0.36,-0.36,-0.35,-0.35,-0.34,-0.32,
	-0.31,-0.30,-0.28,-0.27,-0.25,-0.23,-0.21,-0.19,-0.17,-0.14,-0.12,-0.10,-0.07,-0.05,-0.02,-0.00,
	 0.02, 0.05, 0.07, 0.10, 0.12, 0.14, 0.17, 0.19, 0.21, 0.23, 0.25, 0.27, 0.28, 0.30, 0.31, 0.32,
	 0.34, 0.35, 0.35, 0.36, 0.36, 0.37, 0.37, 0.37, 0.37, 0.36, 0.35, 0.35, 0.34, 0.32, 0.31, 0.29,
	 0.27, 0.25, 0.23, 0.21, 0.18, 0.15, 0.12, 0.09, 0.06, 0.02,-0.01,-0.05,-0.09,-0.13,-0.17,-0.22,
	-0.26,-0.31,-0.35,-0.40,-0.45,-0.50,-0.55,-0.60,-0.65,-0.70,-0.75,-0.80,-0.85,-0.90,-0.95,-1.00,
	-1.05,-1.10,-1.14,-1.19,-1.24,-1.28,-1.32,-1.36,-1.40,-1.44,-1.48,-1.51,-1.55,-1.58,-1.60,-1.63,
	-1.66,-1.68,-1.70,-1.71,-1.73,-1.74,-1.75,-1.76,-1.76,-1.76,-1.76,-1.75,-1.75,-1.74,-1.72,-1.71,
	-1.69,-1.67,-1.64,-1.62,-1.59,-1.55,-1.52,-1.48,-1.44,-1.40,-1.35,-1.30,-1.25,-1.20,-1.15,-1.09,
	-1.03,-0.97,-0.91,-0.85,-0.78,-0.71,-0.65,-0.58,-0.51,-0.44,-0.37,-0.29,-0.22,-0.15,-0.07,-0.00
	};
	int N = 256;
	int i = 0;
	for(i = 0 ; i < 256; i ++){
		Complex a = dit_fft(N,i,data);
		//printf("%f+%fi\n",a.a,a.bi);
			
		float res = cpabs(&a);
		printf("%f\n",res);	
	}
	
	
	return 0;
}

